/*
 *  levelUpGame - Ghost.h
 *  Copyright 2011 W. Reckman. All rights reserved.
 */
#ifndef GHOST_H
#define GHOST_H

#include <string>
#include "ofTypes.h"
#include "GameModel.h"
#include "GridObject.h"
#include "PngSequencePlayer.h"
#include "AStarPathFinder.h"

class ofPoint;
class LevelUpApp;
class Player;
class Settings;


class Ghost : public GridObject {
public:
	enum DYNAMIC_TARGET { DT_PLAYER, DT_PICKUP, DT_ANY };
	
	static const int DEFAULT_FRAME_RATE;
	static const float COLLISION_SCALE;
	
	explicit Ghost( const LevelUpApp& appRef_ );
	
	void setup( const string& path_, const string& prefix_ );
	void update( bool noMovement = false );
	void draw() const;
	
	float getBaseSpeed() const;
	float getSpeedFactor() const;
	BALANCE_KIND getBalanceKind() const;
	
	void setBaseSpeed( float baseSpeed_ );
	void setSpeedFactor( float speedFactor_ );
	void setBalanceKind( BALANCE_KIND kind_ );
	
	void setPlayerTarget( const Player& player_ );
	void setCoordTarget( const ofPoint& coords_ );
	void setDynamicTarget( DYNAMIC_TARGET DynTgt_ );
	
private:
	const LevelUpApp& appRef;
	Settings& s;
	
	int lastNearestPlayer;
	AStarPathFinder pathFinder;
	AStarPathFinder::vec_ofPoint lastPath;
	
	float baseSpeed;
	float speedFactor;
	BALANCE_KIND balanceKind;
	
	float lastGameTime;
	float drawSizeFactor;
	
	PngSequencePlayer seqPlayer;
	
	//TEMP
	int findNearestPlayer( bool onlyCollidables_ ) const;
};

#endif /* ! GHOST_H */
